package com.scsj.supermarket.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.scsj.supermarket.R;
import com.scsj.supermarket.bean.IndexGoodsListBean;

import java.util.List;

/**
 * 首页以及很多地方用到的fragment中的商品列表adapter
 */

public class IndexGoodsListAdapter extends BaseQuickAdapter<IndexGoodsListBean.IndexGoodsList, BaseViewHolder> {

    public IndexGoodsListAdapter(List data) {
        super(R.layout.item_goods_list_base_layout1, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, IndexGoodsListBean.IndexGoodsList item) {

            Glide.with(mContext).load(item.getIndex_icon_iv()).into((ImageView) helper.getView(R.id.index_icon_iv));
            helper.setText(R.id.index_name_tv, item.getIndex_name_tv());
            helper.setText(R.id.index_type1_tv, item.getIndex_type1_tv());
            helper.setText(R.id.index_type2_tv, item.getIndex_type2_tv());
            helper.setText(R.id.index_type3_tv, item.getIndex_type3_tv());
//            helper.setRating(R.id.index_comm_rb, item.getIndex_comm_rb());
            helper.setText(R.id.index_num_tv, item.getIndex_num_tv());
            helper.setText(R.id.index_content_tv, item.getIndex_content_tv());
            helper.setText(R.id.index_tiket_tv, item.getIndex_tiket_tv());
            helper.setText(R.id.index_cut_tv, item.getIndex_cut_tv());

    }
}
